#include "dominion.h"
#include "dominion_helpers.h"
#include "rngs.h"
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

void test_updateCoins() {
        int player = 0;
        struct gameState* state = newGame();
        int bonus = 0;

        state->handCount[player] = 3;

        //hand of coppers

        state->hand[player][0] = copper;
        state->hand[player][1] = copper;
        state->hand[player][2] = copper;

        updateCoins(player, state, bonus);

        if (state->coins == 3) {
                printf("updateCoins(): PASS when test has 3 coppers as hand\n");
        }
        else {
                printf("updateCoins(): FAIL when test has 3 coppers as hand\n");
        }

        //hand of silvers
        
        state->hand[player][0] = silver;
        state->hand[player][1] = silver;
        state->hand[player][2] = silver;

        updateCoins(player, state, bonus);

        if (state->coins == 6) {
                printf("updateCoins(): PASS when test has 3 silvers as hand\n");
        }
        else {
                printf("updateCoins(): FAIL when test has 3 silvers as hand\n");
        }

        //hand of golds

        state->hand[player][0] = gold;
        state->hand[player][1] = gold;
        state->hand[player][2] = gold;

        updateCoins(player, state, bonus);

        if (state->coins == 9) {
                printf("updateCoins(): PASS when test has 3 golds as hand\n");
        }
        else {
                printf("updateCoins(): FAIL when test has 3 golds as hand\n");
        }

        //hand of mixture

        state->hand[player][0] = copper;
        state->hand[player][1] = silver;
        state->hand[player][2] = gold;

        updateCoins(player, state, bonus);

        if (state->coins == 6) {
                printf("updateCoins(): PASS when test has a copper, gold, & silver as hand\n");
        }
        else {
                printf("updateCoins(): FAIL when test has a copper, gold, & silver as hand\n");
        }

        //hand of something with bonus
        state->hand[player][0] = copper;
        state->hand[player][1] = silver;
        state->hand[player][2] = gold;
        bonus = 1;

        updateCoins(player, state, bonus);

        if (state->coins == 7) {
                printf("updateCoins(): PASS when test has a copper, gold, & silver as hand plus 1 bonus\n");
        }
        else {
                printf("updateCoins(): FAIL when test has a copper, gold, & silver as hand plus 1 bonus\n");
        }
}

int main() {
        test_updateCoins();
}
